微信开发者工具勾选 将JS编译成ES5 ,unicloud的get查询会报错 ‘ReferenceError: _t3 is not defined’。取消JS编译成ES5则正常,但是取消后点预览会有这个提示
message:Error: 非法的文件,错误信息:invalid file: uni_modules/uni-id-pages/common/store.js, 1:1387, SyntaxError: Unexpected token ?!function(){"use strict";const e=require("../../../common/vendor.js"),n=require("../config.js"),i=e.Es.importObject("uni-id-co"),t=e.Es.database().collection("uni-id-users");let o=e.index.getStorageSync("uni-id-pages-userInfo")||{};const s={userInfo:o,hasLogin:0!=Object.keys(o).length},r={async updateUserInfo(n=!1){if(n)t.where("_id==$env.uid").update(n).then(i=>{i.result.updated?(e.index.showToast({title:"更新成功",icon:"none",duration:3e3}),this.setUserInfo(n)):e.index.showToast({title:"没有改变",icon:"none",duration:3e3})});else{const n=e.Es.importObject("uni-id-co",{customUI:!0});try{let e=await t.where("'_id' == $cloudEnv_uid").field("mobile,nickname,username,email,avatar_file").get();const i=await n.getRealNameInfo();this.setUserInfo({...e.result.data[0],realNameAuth:i})}catch(e){this.setUserInfo({},{cover:!0}),console.error(e.message,e.errCode)}}},async setUserInfo(n,{cover:i}={cover:!1}){let t=i?n:Object.assign(a.userInfo,n);return a.userInfo=Object.assign({},t),a.hasLogin=0!=Object.keys(a.userInfo).length,e.index.setStorage({key:"uni-id-pages-userInfo",data:a.userInfo}),n},async logout(){var n;if(e.Es.getCurrentUserInfo().tokenExpired>Date.now())try{await i.logout()}catch(e){console.error(e)}e.index.removeStorageSync("uni_id_token"),e.index.setStorageSync("uni_id_token_expired",0),e.index.redirectTo({url:"/"+((null==(n=e.pagesJson.uniIdRouter)?void 0:n.loginPage)??"uni_modules/uni-id-pages/pages/login/login-withoutpwd")}),e.index.$emit("uni-id-pages-logout"),this.setUserInfo({},{cover:!0})},loginBack(n={}){const{uniIdRedirectUrl:i=""}=n;let t=0,o=getCurrentPages();if(o.forEach((e,n)=>{"login"==o[o.length-n-1].route.split("/")[3]&&t++}),i)return e.index.reLaunch({url:i});if(t){const n=e.pagesJson.pages[0];return e.index.reLaunch({url:"/"+n.path})}e.index.navigateBack({delta:t})},loginSuccess(i={}){const{showToast:t=!0,toastText:o="登录成功",autoBack:s=!0,uniIdRedirectUrl:r="",passwordConfirmed:a}=i;if(t&&e.index.showToast({title:o,icon:"none",duration:3e3}),this.updateUserInfo(),e.index.$emit("uni-id-pages-login-success"),n.config.setPasswordAfterLogin&&!a)return e.index.redirectTo({url:r?/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?uniIdRedirectUrl=${r}&loginType=${i.loginType}:"/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?loginType="+i.loginType,fail:e=>{console.log(e)}});s&&this.loginBack({uniIdRedirectUrl:r})}},a=e.reactive(s);exports.mutations=r}(); [20230323 00:22:25][wx92f12e36061bf318]appid: wx92f12e36061bf318openid: o6zAJsz7xX24lcJyKAAJgFo2VlmAideVersion: 1.06.2303222osType: darwin-x64time: 2023-03-23 00:22:31
勾选JS编译ES5则能正常生成二维码预览。